package github.flandre.examplemod.core.init;

import github.flandre.examplemod.client.gui.ExampleOpenGUIItem;
import github.flandre.examplemod.common.block.ExampleCropsBlock;
import github.flandre.examplemod.common.energy.item.FEDemoItem;
import github.flandre.examplemod.common.entity.ExampleEntity;
import github.flandre.examplemod.common.item.ExampleItem;
import github.flandre.examplemod.common.item.InfiniteSnowball;
import github.flandre.examplemod.common.item.MagicBoard;
import github.flandre.examplemod.common.item.armor.ExampleArmorMaterial;
import github.flandre.examplemod.common.item.armor.ExampleHelmet;
import github.flandre.examplemod.common.item.food.ExampleFood;
import github.flandre.examplemod.common.item.tools.ExamplePickaxe;
import github.flandre.examplemod.common.item.tools.ExampleSword;
import github.flandre.examplemod.core.init.Itemgroup.ExampleGroup;
import github.flandre.examplemod.examplemod;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityType;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.SpawnEggItem;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;





public class ItemInit {
    //注册对象获取
    public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, examplemod.MODID);

    //注册物品
    public static final RegistryObject<ExampleItem> EXAMPLE_ITEM =
            ITEMS.register("example_item",//物品名 在item一定要和注册的物品名相同
                    ExampleItem::new);
    //然后需要把注册对象加到forge里面


    //食物注册
    public static final RegistryObject<ExampleFood> EXAMPLE_FOOD =
            ITEMS.register("example_food",
                    ExampleFood::new);

    //剑注册
    public static final RegistryObject<ExampleSword> EXAMPLE_SWORD =
            ITEMS.register("example_sword",
                    ExampleSword::new);
    //稿子注册
    public static final RegistryObject<ExamplePickaxe> EXAMPLE_PICKAXE =
            ITEMS.register("example_pickaxe",
                    ExamplePickaxe::new);

    //头注册
    public static final RegistryObject<ExampleHelmet> EXAMPLE_HELMET =
            ITEMS.register("example_helmet",
                    ExampleHelmet::new);

    

    //其他位置创建方式
    public static final RegistryObject<Item> EXAMPLE_CHEST =
           ITEMS.register("example_chest",
                   ()->new ArmorItem(ExampleArmorMaterial.EXAMPLE,
                           EquipmentSlotType.CHEST, //装备位置
                           new Item.Properties().group(ExampleGroup.exampleGroup)));

    public static final RegistryObject<Item> EXAMPLE_LEGGINGS =
            ITEMS.register("example_leggings",
                    ()->new ArmorItem(ExampleArmorMaterial.EXAMPLE,
                            EquipmentSlotType.LEGS, //装备位置
                            new Item.Properties().group(ExampleGroup.exampleGroup)));

    public static final RegistryObject<Item> EXAMPLE_BOOTS =
            ITEMS.register("example_boots",
                    ()->new ArmorItem(ExampleArmorMaterial.EXAMPLE,
                            EquipmentSlotType.FEET, //装备位置
                            new Item.Properties().group(ExampleGroup.exampleGroup)));


    //铁板注册
    public static final RegistryObject<Item> MAGIC_BOARD =
            ITEMS.register("magic_board",
                    MagicBoard::new);

    //注册方块的物品
//    public static final RegistryObject<Item> EXAMPLE_BLOCK =
//            ITEMS.register("example_block",
//                    ()->new BlockItem(
//                            BlockInit.EXAMPLE_BLOCK.get(),
//                            new Item.Properties().group(ExampleGroup.exampleGroup)          ));

    //ExampleDirectionBlock
    public static final RegistryObject<Item> EXAMPLE_DIRECTION_BLOCK =
            ITEMS.register("example_direction_block",
                    ()->new BlockItem(
                            BlockInit.EXAMPLE_DIRECTION_BLOCK.get(),
                            new Item.Properties().group(ExampleGroup.exampleGroup)));

    public static final RegistryObject<Item> CUSTOM_BLOCK =
            ITEMS.register("custom_block",
                    ()->new BlockItem(
                            BlockInit.CUSTOM_BLOCK.get(),
                            new Item.Properties().group(ExampleGroup.exampleGroup)));

    public static final RegistryObject<Item> LUOLI_BLOCK =
            ITEMS.register("luoli_block",
                    ()->new BlockItem(
                            BlockInit.LUOLI_BLOCK.get(),
                            new Item.Properties().group(ExampleGroup.exampleGroup)));

    public static final RegistryObject<Item> EXAMPLE_GUI_BLOCK =
            ITEMS.register("example_gui_block",
                    ()->new BlockItem(
                            BlockInit.EXAMPLE_GUI_BLOCK.get(),
                            new Item.Properties().group(ExampleGroup.exampleGroup)));



    //注册无限雪球
    public static final RegistryObject<InfiniteSnowball> INFINITE_SNOWBALL =
            ITEMS.register("infinite_snowball",//物品名 在item一定要和注册的物品名相同
                    InfiniteSnowball::new);


    //public static final Item COD_SPAWN_EGG =
    // register("cod_spawn_egg", new SpawnEggItem(EntityType.COD, 12691306, 15058059, (new Item.Properties()).group(ItemGroup.MISC)));
    //刷怪蛋
    public static final RegistryObject<Item> EXAMPLE_ENTITY_EGG =
            ITEMS.register("example_entity_egg",
                    ()->new SpawnEggItem(
                            ExampleEntity.getEntityType(),
                            12691306, 15058059,
                            new Item.Properties().group(ExampleGroup.exampleGroup)
                    ));
    //还需要创建json文件


    //注册带gui的物品
    public static final RegistryObject<ExampleOpenGUIItem> EXAMPLE_OPEN_GUI_ITEM_REGISTRY_OBJECT =
            ITEMS.register("example_open_gui",//物品名 在item一定要和注册的物品名相同
                    ExampleOpenGUIItem::new);



    public static final RegistryObject<Item> EXAMPLE_LOG =
            ITEMS.register("example_log",
                    ()->new BlockItem(
                            BlockInit.EXAMPLE_LOG.get(),
                            new Item.Properties().group(ExampleGroup.exampleGroup)));

    public static final RegistryObject<Item> EXAMPLE_LEAVES =
            ITEMS.register("example_leaves",
                    ()->new BlockItem(
                            BlockInit.EXAMPLE_LEAVES.get(),
                            new Item.Properties().group(ExampleGroup.exampleGroup)));

    public static final RegistryObject<Item> EXAMPLE_SAPLING =
            ITEMS.register("example_sapling",
                    ()->new BlockItem(
                            BlockInit.EXAMPLE_SAPLING.get(),
                            new Item.Properties().group(ExampleGroup.exampleGroup)));


    public static final RegistryObject<FEDemoItem> FE_DEMO_ITEM_REGISTRY =
            ITEMS.register("example_fed",
                    FEDemoItem::new);


}
